<script>
import {getHomeworkQuestionnaire} from "../../api/apiz";

export default {
  name: "questionnaireDetail",
  data(){
    return{
      classId: '',
      questionnaireDescription: '请认真填写，谢谢！',
      tableData: [],
      introduction: '',
      browseTime: 0,  // 浏览时长初始值为 0
      clearTimeSet: null,
      arrList: []
    }
  },
  methods: {
    getDetail(studentId,taskOriginId){
      let parems = {
        studentId: studentId,
        taskOriginId: taskOriginId
      }
      getHomeworkQuestionnaire(parems).then(res => {
        if (res.code == 200){
          res.result.thinkResultTopic.map(item => {
            item.thinkResultDetail.map(child => {
              if (child.answer == null){
                child.activeStatus = false
              }else{
                child.activeStatus = true
              }
            })
          })
          this.tableData = res.result.thinkResultTopic
        }
      })
    },
  },
}
</script>

<template>
  <div class="questionnaireDetailHome" >
    <div class="card-list">
      <div class="card_meuns" v-for="(item,index) in tableData" :key="index">
        <div class="card_meuns_header">
          <div class="card_status" v-if="item.topicType == 1">单选</div>
          <div class="card_status" v-else-if="item.topicType == 2">多选</div>
          <div class="card_status" v-else-if="item.topicType == 3">简答</div>
          <div class="card_title">{{ item.orderNo + 1 }}. <div v-html="item.topicDescription" class="card_title"></div></div>
        </div>
        <div class="card_footer">
          <div v-for="(child,childIndex) in item.thinkResultDetail" :key="childIndex">
            <div v-if="item.topicType == 1 || item.topicType == 2">
              <div class="card_footer_list" >
                <img v-if="child.activeStatus" src="../../assets/circle-filled.png" style="width: 20px;height: 20px;">
                <img v-else src="../../assets/circle.png" style="width: 20px;height: 20px;">
                <div class="card_text flex align-center">{{ child.optionSign }}.<span v-html="child.optionDescription" class="card_text"></span></div>
              </div>
            </div>
            <div v-else-if="item.topicType == 3">
              <el-input type="textarea" v-model="child.answer" placeholder="请在此输入答案" disabled />
            </div>
          </div>
        </div>
      </div>
      <div>
        <el-empty description="暂无数据" :image-size="120" v-if="tableData.length == 0"></el-empty>
      </div>
    </div>
  </div>
</template>

<style scoped lang="less">
.questionnaireDetailHome{
  ::v-deep .uni-textarea-textarea{
    color: #1f1f1f !important;
  }
  .card_meuns_header{
    display: flex;
    align-items: center;
  }
  .card-list{
    margin: 10px 12px 0 12px ;
    padding: 10px 12px;
    height: calc(100vh - 240px);
    overflow: hidden;
    overflow-y: auto;
    .card_meuns{
      margin-bottom: 15px;
      .card_status{
        font-family: myIconfont;
        font-size: 12px;
        color: #0B96B4;
        font-weight: 400;
        letter-spacing: 2px;
        background: #E6F9F9;
        min-width: 40px;
        border-radius: 12px 15px 15px 0;
        display: flex;
        align-items: center;
        justify-content: center;
      }
      .card_title{
        font-family: myIconfont;
        font-size: 13px;
        color: #000000;
        font-weight: 700;
        letter-spacing: 1px;
        margin-left: 10px;
        display: flex;
        align-items: center;
      }
      .card_footer{
        margin-top:12px;
        .card_footer_list{
          display: flex;
          align-items: center;
          background: #F7F8F9;
          padding: 10px 12px;
          margin-bottom: 10px;
          border-radius: 10px;
        }
        .card_text{
          font-family: myIconfont;
          font-size: 13px;
          color: #212121;
          font-weight: 400;
          letter-spacing: 1px;
          margin-left: 10px;
        }
      }
    }
  }
}
</style>
